package com.lovenote.common.dao.impl;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.base.common.dao.impl.BaseDaoImpl;
import com.lovenote.common.dao.INoteCatalogDao;
import com.lovenote.common.pojo.NoteCatalog;

@Repository("noteCatalogDao")
public class NoteCatalogDaoImpl extends BaseDaoImpl<NoteCatalog, Integer> implements INoteCatalogDao {

	@Override
	public boolean deleteCatalog(long userId, int catalogId) {
		String hql = "delete NoteCatalog where id = ? and userId = ?";
		Query query = getSession().createQuery(hql);
		query.setParameter(0, catalogId).setParameter(1, userId);
		int rows = query.executeUpdate();
		if (rows >= 1) {
			return true;
		}
		return false;
	}

}
